package remote_work.core.service;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import remote_work.dto.InputObject;
import remote_work.dto.OutputObject;
import remote_work.util.DBHelper;
import remote_work.util.MyService;

/**
 * 人员信息（教师、学生、管理员等）
 * 
 * @author LiuPing
 *
 * 2018年3月21日
 */
@MyService
public class PersonService {
	
	public static void main(String[] args) {
		DBHelper dao = new DBHelper();
//		String sql = "insert into test(id,name) values(1,'apple')";
//		dao.doUpdate(sql, null);
		String sql = "select * from test";
		try {
			List list = dao.find(sql, null);
			System.out.println(list.size());
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	/**
	 * 获取人员信息
	 * 
	 * @param inputObject
	 * @return
	 * @throws SQLException 
	 */
	public OutputObject getPerson(InputObject inputObject) throws SQLException {
		OutputObject outputObject = new OutputObject();
		DBHelper dao = new DBHelper();
		String sql = "select * from userinfo where 1=1";
		/*List<Object> params = new ArrayList<>();
		params.add(inputObject.getValue(""));*/
		outputObject.setBeans(dao.find(sql, null));
		return outputObject;
	}
	
	public OutputObject addPerson(InputObject inputObject) {
		OutputObject outputObject = new OutputObject();
		
		
		return outputObject;
	}
}
